﻿<%@ Control Language="C#" ClassName="Bridge_Notes" Inherits="Dimok.Web.UI.TableControlAjax" %>
<script runat="server">
	protected override void OnInit(EventArgs e) {
		WSEntityType = typeof(v_Note);
		ProfileID = "{267E002B-F519-477a-A3BF-8A6F8BA6A716}";
		ClientType = "motobankcorp.Bridge_Notes";
		base.OnInit(e);
	}
	void ds_Selecting(object sender, LinqDataSourceSelectEventArgs e) {
	e.Result = new List<v_Note>();
}
</script>
<UI:RadGridExtender runat="server" />
<fieldset id="Container" RunAt="server"><legend>Notes</legend>
<telerik:RadGrid runat="server" />
</fieldset>
<style>
.NotePopup{white-space:pre;background-color:BlanchedAlmond;border:solid 1px silver}
</style>
<pre ID="pnlNote" style='display:none;white-space:pre' Class="NotePopup" onprerender="ScriptLocalGet" runat="server"></pre>
<ajaxtk:HoverMenuExtender ID="HoverMenuExtender1" BehaviorID="hvrNote" TargetControlID="pnlNote" PopupControlID="pnlNote" runat="server" />
<script>
	function InitNoteHover(element, html) {
		if (!element.initialized) {
			element.initialized = true;
			$addHandler(element, "mouseout", function() { clearTimeout(InitNoteHover.proc); });
		}
		if (event) {
			clearTimeout(InitNoteHover.proc);
			return InitNoteHover.proc = setTimeout(function() { InitNoteHover(element, html) }, 200);
		}
		clearTimeout(InitNoteHover.proc);
		//Regex.Replace(Regex.Replace(Note, "[.]{2,}", "\n"), ".{" + MaxLineLength + "}", "$0\n");
		html = html.replace(/[.]{2,}/g, "\n").replace(/.{80}/g, "$0\n");
		html = html.replace(/\n/g, "<br>");
		var hover = $find("hvrNote");
		if (hover && hover._element == element) return;
		if (hover) { hover.dispose(); hover = null; }
		$create(AjaxControlToolkit.HoverMenuBehavior, { "HoverCssClass": "NoteHover",
			"HoverDelay": 0,
			"OffsetX": 50,
			"dynamicServicePath": "/manager/USIX/USIXBridge.aspx",
			"id": "hvrNote",
			"popupElement": pnlNote()
		}, null, null, element);
		hover = $find("hvrNote");
		hover._popupElement.innerHTML = html;
		//hover._onmouseover();	hover._onHover();
		InitNoteHover.proc = setTimeout(function() { hover._onmouseover(); hover._onHover(); }, 100);
	};
	Type.registerNamespace('bridgeNotes');
	bridgeNotes.showNote = function(el, hide) {
		var style = el.style;
		style.overflow = hide ? 'hidden' : 'visible';
		style.borderWidth = hide ? 0 : 1;
		if (!hide) event.cancelBubble = true;
	}
</script>
